var _util = require('../util/util.js');
var _store_service = {
    //获取当前卖家的所有店铺
    getAllStores: function (resolve, reject) {
        _util.request({
            url: _util.getServerURL('/shop/shops'),
            method: 'GET',
            success: resolve,
            error: reject
        });
    },
    getOneStore: function (shopid, resolve, reject) {
        _util.request({
            url: _util.getServerURL('/shop/shops/' + shopid),
            method: 'GET',
            success: resolve,
            error: reject
        });
    },
    addNewStore: function (shop, resolve, reject) {
        _util.request({
            url: _util.getServerURL('/shop/shops'),
            data: shop,
            method: 'POST',
            success: resolve,
            error: reject
        });
    },
    updateStore: function (shop, resolve, reject) {
        _util.request({
            url: _util.getServerURL('/shop/shops'),
            data: shop,
            method: 'PUT',
            success: resolve,
            error: reject
        });
    },
    deliverItem: function (orderid, resolve, reject) {
        _util.request({
            url: _util.getServerURL('/orders/' + orderid + '/deliver'),
            method: 'POST',
            success: resolve,
            error: reject
        });
    },
    confirmReturn: function (orderid, resolve, reject) {
        _util.request({
            url: _util.getServerURL('/orders/' + orderid + '/confirmreturn'),
            method: 'POST',
            success: resolve,
            error: reject
        });
    },
    refuseReturn: function (orderid, resolve, reject) {
        _util.request({
            url: _util.getServerURL('/orders/' + orderid + '/refusereturn'),
            method: 'POST',
            success: resolve,
            error: reject
        });
    },
    getSellerOrders: function (status, resolve, reject) {
        _util.request({
            url: _util.getServerURL('/orders/' + orderid + '/deliver'),
            method: 'GET',
            success: resolve,
            error: reject
        });
    },
    addNewItem: function (itemVO2, resolve, reject) {
        _util.request({
            url: _util.getServerURL('/catalog/items'),
            method: 'POST',
            data: itemVO2,
            success: resolve,
            error: reject
        });
    },
}
module.exports = _store_service